package com.example.micro.netty.server.nio.buffer;

import java.nio.ByteBuffer;

public class NIOByteBufferOnlyRead {

    public static void main(String[] args) {

        ByteBuffer byteBuffer = ByteBuffer.allocate(20);
        for (int i = 0; i < 10; i++) {
            byteBuffer.put((byte) i);
        }

        ByteBuffer readOnlyByteBuffer = byteBuffer.asReadOnlyBuffer();
        readOnlyByteBuffer.put((byte) 1);

    }

}
